<template>
  <div class="button-example">
      <el-button type="primary" @click="handleLogin">测试登录</el-button>
      <el-button type="success" @click="handleUserList">测试获取用户信息列表</el-button>
  </div>
</template>

<script setup>
import requestUtil from '@/utils/request'

const handleLogin = async() =>{
  let result = await requestUtil.get("user/jwt_test/")
  let data = result.data
  if(data.code == 200){
    const token = data.token
    console.log("登录成功,token=" + token)
    window.sessionStorage.setItem("token", token)
  }else{
    console.log("登录出错")
  }
}

const handleUserList = async() =>{
  let result = await requestUtil.get("user/test/")
  let data = result.data
  if(data.code == 200){
    let userList = data.data
    console.log("用户信息列表userList=" + userList)
  }else{
    console.log("登录出错")
  }
}
// import {
//   Check,
//   Delete,
//   Edit,
//   Message,
//   Search,
//   Star,
// } from '@element-plus/icons-vue'

</script>
<!-- 
<style scoped>
.button-example {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.button-row > * {
  margin: 0;
}
</style> -->
